<template>
  <div class="post-manage-container">
    <el-card shadow="hover">
      <div class="header">
        <h2>公告管理</h2>
      </div>
      <el-table :data="posts" stripe border style="width: 100%; margin-top: 20px;">
        <el-table-column prop="id" label="公告ID" width="120" />
        <el-table-column prop="title" label="标题" width="200" />
        <el-table-column prop="author" label="发布人" width="120" />
        <el-table-column prop="date" label="发布时间" width="160" />
        <el-table-column label="操作" width="200">
          <template #default="scope">
            <el-button size="small" @click="onDetail(scope.row)" icon="el-icon-view">详情</el-button>
            <el-button size="small" type="danger" @click="onDelete(scope.row)" icon="el-icon-delete">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
    <el-dialog v-model="dialogVisible" title="公告详情" width="500px">
      <el-form :model="form">
        <el-form-item label="公告ID"><el-input v-model="form.id" disabled /></el-form-item>
        <el-form-item label="标题"><el-input v-model="form.title" /></el-form-item>
        <el-form-item label="发布人"><el-input v-model="form.author" /></el-form-item>
        <el-form-item label="发布时间"><el-input v-model="form.date" /></el-form-item>
      </el-form>
      <template #footer>
        <el-button @click="dialogVisible=false">关闭</el-button>
      </template>
    </el-dialog>
  </div>
</template>
<script setup>
import { ref } from 'vue';
const posts = ref([
  { id: 'N001', title: '关于创新项目申报的通知', author: '管理员', date: '2024-05-01' },
  { id: 'N002', title: '中期检查安排', author: '管理员', date: '2024-05-10' },
]);
const dialogVisible = ref(false);
const form = ref({});
function onDetail(row) { form.value = { ...row }; dialogVisible.value = true; }
function onDelete(row) { posts.value = posts.value.filter(p => p.id !== row.id); }
</script>
<style scoped>
.post-manage-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 0;
  background: #f5f7fa;
  min-height: 100vh;
}
.header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}
</style> 